package com.wdz.utils;

import java.io.Serializable;

public class PageUtil implements Serializable {
    private static final long serialVersionUID = 6534516227740948762L;
    /**
     * 从1开始
     */
    private Integer pageNo;
    private Integer pageSize;
    private Integer total;
    private Integer pages;
    private Object data;

    public Integer getPageNo() {
        return pageNo;
    }

    public void setPageNo(Integer pageNo) {
            this.pageNo = pageNo;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Integer getTotal() {
        return total;
    }

    public void setTotal(Integer total) {
        this.total = total;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public Integer getPages() {
        if(this.pages == null & this.total != null && this.pageSize != null){
            this.pages = (int)Math.ceil((double)this.total/(double)this.pageSize);
        }
        return pages;
    }

    public void setPages(Integer pages) {
        this.pages = pages;
    }
}
